import request from '@/utils/request'
// 获取学科简单列表
export const getSubject = () => {
  return request.get('/subjects')
}
// 获取学科详情
export const getSubjectDetail = (id) => {
  return request({
    url: `/subjects/${id}`,
    method: 'get'
  })
}
// 获取学科修改
export const updateSubject = (data) => {
  return request({
    url: `/subjects/${data.id}`,
    method: 'put',
    data
  })
}
// 新增学科
export const addSubject = (data) => {
  return request({
    url: `/subjects`,
    method: 'post',
    data
  })
}
// 删除学科
export const removeSubject = (id) => {
  return request({
    url: `/subjects/${id}`,
    method: 'DELETE'
  })
}
// 获取目录的列表
export const getCatalogue = (params) => {
  return request({
    url: '/directorys',
    method: 'get',
    params
  })
}
// 获取添加目录的列表
export const addCatalogue = (data) => {
  return request({
    url: '/directorys',
    method: 'POST',
    data
  })
}
// 目录详情
export const getCatalogueDetail = (id) => {
  return request({
    url: `/directorys/${id}`,
    method: 'get'
  })
}
// 目录详情修改
export const updateCatalogueDetail = (data) => {
  return request({
    url: `/directorys/${data.id}`,
    method: 'put',
    data
  })
}
// 目录状态
export const resetCatalogue = (data) => {
  return request({
    url: `/directorys/${data.id}/${data.state}`,
    method: 'post'

  })
}
// 目录删除
export const remove = data => {
  return request({
    url: `/directorys/${data.id}`,
    method: 'delete',
    data

  })
}
// 学科简单列表
export const simple = data => {
  return request({
    url: `/subjects/simple`,
    method: 'get',
    data

  })
}
